#include "iGraphics.h"

#include <iostream>
#include <cstdio>
#include <string>

#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")

using namespace std;

int menusel = 0, soundflag = 1;

void iDraw()
{
	iClear();

	glutReshapeWindow(512, 512);
	iShowBMP(0, 0, "images\\Menu.bmp");
	
		iShowBMP(45, 327 - menusel*48, "images\\ArrowR.bmp"); 
		iShowBMP(435, 327 - menusel * 48, "images\\ArrowL.bmp");
}

void iMouseMove(int mx, int my)
{
	//REQUIRED BLANK FUNCTION
}

void iMouse(int button, int state, int mx, int my)
{
	//REQUIRED BLANK FUNCTION
}

void iKeyboard(unsigned char key)
{
	if (key == '\r')
	{
		if (menusel == 5) exit(0);
		else if (menusel == 4) {
			if (soundflag == 1) {
				PlaySound(0, 0, 0);
				soundflag = 0;
			}
			else {
				PlaySound("Butterfly.wav", NULL, SND_LOOP | SND_ASYNC);
				soundflag = 1;
			}
		}
	}
}

void iSpecialKeyboard(unsigned char key) //INPUTS
{
	if (key == GLUT_KEY_DOWN)
	{
		if (menusel < 5) menusel++;
		else menusel = 0;
	}

	else if (key == GLUT_KEY_UP)
	{
		if (menusel > 0) menusel--;
		else menusel = 5;
	}
}

int main() {
	PlaySound("Butterfly.wav", NULL, SND_LOOP | SND_ASYNC);
	iInitialize(512, 512, "Hangman++ HD");
	return 0;
}